home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / P_ROBO31.ZIP / MECHANIC.PR < prev    next >
Text File  |  1989-10-23  |  2KB  |  68 lines

  1. (**************************************************************************)
  2. (*                             W A R N I N G                              *)
  3. (*                                                                        *)
  4. (*  This Robot has NOT been designed to take advantage of the advanced    *)
  5. (*  features of P-ROBOTS, such as, Shields, Fuel, Teams or Obstructions.  *)
  6. (**************************************************************************)
  7.  
  8.   PROCEDURE Mechanic;
  9.  
  10.     { Based on a C-Robot By Bruce Oberleitner }
  11.  
  12.  
  13.     {     Sometimes, simplicity is best.  This robot has absolutely    }
  14.     {     no defense whatsoever!!  It quickly locks onto a target      }
  15.     {     and chases it around the playfield.  It relies on the target }
  16.     {     going into a defensive mode while it stays on the ofensive.  }
  17.     {     If the target is destroyed or it moves out of the scan area, }
  18.     {     a new target is selected and fired upon.                     }
  19.  
  20.  
  21.   VAR Range      : Integer;
  22.     Angle          : Integer;
  23.  
  24.  
  25.     PROCEDURE med_scan(scan_angle : Integer);
  26.       { within 10 degrees of original scan angle  }
  27.  
  28.     VAR temp_angle : Integer;
  29.       res            : Integer;
  30.       Inc            : Integer;
  31.     BEGIN
  32.       temp_angle := scan_angle-5;
  33.       WHILE (temp_angle <= (scan_angle+30)) DO
  34.         BEGIN
  35.           Range := scan(temp_angle, 5); { scan 10 degree section }
  36.           drive(temp_angle, 50);
  37.           IF (Range <> 0) THEN 
  38.             cannon(temp_angle, Range);
  39.           IF (Range = 0) THEN
  40.             temp_angle := temp_angle+5;
  41.         END; { while }
  42.     END; { end of med_scan }
  43.  
  44.  
  45.     PROCEDURE corse_scan(scan_angle : Integer);
  46.     BEGIN 
  47.       WHILE True DO {Loop Forever}
  48.         BEGIN
  49.           Range := scan(scan_angle, 10);
  50.           IF (Range <> 0) THEN
  51.             BEGIN
  52.               cannon(scan_angle, Range); { take a real potshot }
  53.               drive(scan_angle, 50);
  54.               med_scan(scan_angle);
  55.             END;
  56.           scan_angle := scan_angle+20;
  57.         END;
  58.     END; { end of corse sub-program }
  59.  
  60.  
  61.   BEGIN {Mechanic Main}
  62.     Angle := Random(360);
  63.     corse_scan(Angle);
  64.   END; {end of Mechanic Main program }
  65.  
  66.  
  67.  
  68.